package mybatis_ex2;

import javax.annotation.Resource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.imooc.bean.Message;
import com.imooc.dao.MessageDao;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:spring/applicationContext.xml")
public class MybatisTest01 {
	@Resource
	private MessageDao messageDao;
	
	@Test
	public void demo01() {
		int result=messageDao.count(new Message());
		System.out.println("result:"+result);
	}
	
	@Test
	public void demo02() {
		double d=0.6332;
		System.err.println((int)((Math.random()*9+1)*Math.pow(10, 5)));
		System.out.println(getValue(2));
		System.out.println(Math.round(0.6));
		System.out.println(Math.round(-0.6));
		System.out.println(Math.round(-8.9));
		System.out.println(Math.round(-8.1));
		System.out.println(Math.round(8.9));
		System.out.println(Math.round(8.1));
		System.out.println(Math.round(-8.5));
		System.out.println(Math.round(8.5));
		char c='中';
		System.out.println(c);
	}
	
    public static int getValue(int i) {
        int result = 0;
        switch (i) {
        case 1:
            result = result + i;
        case 2:
            result = result + i * 2;
        case 3:
            result = result + i * 3;
        }
        return result;
    }

}
